home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / play / tracker_4_31.lzh / tracker / Amiga / scroll.c < prev    next >
C/C++ Source or Header  |  1995-05-11  |  2KB  |  108 lines

  1. /* amiga/scroll.c
  2.     vi:ts=3 sw=3:
  3.  */
  4.  
  5. /* $Id: scroll.c,v 1.4 1995/05/11 12:09:26 espie Exp espie $
  6.  * $Log: scroll.c,v $
  7.  * Revision 1.4  1995/05/11  12:09:26  espie
  8.  * Dummy call added.
  9.  *
  10.  * Revision 1.3  1995/02/14  16:51:22  espie
  11.  * *** empty log message ***
  12.  *
  13.  * Revision 1.2  1995/02/13  22:05:42  espie
  14.  * Added one space to buffer.
  15.  *
  16.  * Revision 1.1  1995/01/13  13:31:35  espie
  17.  * Initial revision
  18.  *
  19.  */
  20.  
  21. #include <proto/exec.h>
  22.  
  23. #include "defs.h"
  24. #include "extern.h"
  25. #include "amiga/amiga.h"
  26. #include "prefs.h"
  27. ID("$Id")
  28.  
  29. XT unsigned int inhibit_output;
  30.  
  31. LOCAL void init_scroll(void);
  32. LOCAL void (*INIT)(void) = init_scroll;
  33.  
  34. /* the special structure to display lines 
  35.  *    
  36.  */
  37. LOCAL struct MinList scrolls;
  38.  
  39. struct scroll_line
  40.    {
  41.    struct MinNode node;
  42.    char buffer[80];
  43.    };
  44.  
  45. LOCAL void init_scroll()
  46.    {
  47.    NewList(&scrolls);
  48.    }
  49.  
  50. /***
  51.  ***
  52.  ***    Scrolling line handling: 
  53.  ***        note this is totally asynchronous and uses the TYPE_DO_SYNC
  54.  ***        message for synchronizing with songs that are really played
  55.  ***/
  56.  
  57. LOCAL struct scroll_line *scroll_buffer = 0;
  58.  
  59. char *new_scroll(void)
  60.    {
  61.    char *s;
  62.        /* need some temporary storage in case everything is full */
  63.     LOCAL char buffer[80];
  64.  
  65.    INIT_ONCE;
  66.                            /* check for a scroll line available */
  67.    scroll_buffer = RemHead(&scrolls);
  68.    if (!scroll_buffer)     /* none available ? allocate one on the fly */
  69.       scroll_buffer = malloc(sizeof(struct scroll_line));
  70.    if (scroll_buffer)
  71.       s = scroll_buffer->buffer;
  72.    else                    /* still none ? use static buffer */
  73.       s = buffer;
  74.    strcpy(s, "                                                        ");
  75.    return s;
  76.    }
  77.  
  78. /* The actual hook that does all the printing */
  79. LOCAL void do_scroll(VALUE p)  
  80.    {
  81.    struct scroll_line *s = p.pointer;
  82.     
  83.     if (inhibit_output == 0 && get_pref_scalar(PREF_SHOW))
  84.         {
  85.         add_scroller(s->buffer);
  86.       }
  87.     AddTail(&scrolls, s);
  88.    }
  89.  
  90. void scroll()
  91.    {
  92.    struct ext_message *msg;
  93.    
  94.    if (scroll_buffer)        /* did we obtain a scroll line ? */
  95.       {                    /* then set up to scroll it */
  96.       msg = obtain_message();
  97.       msg->data.hook.func = do_scroll;
  98.       msg->data.hook.p.pointer = scroll_buffer;
  99.       send(msg, TYPE_SYNC_DO);
  100.       }
  101.    scroll_buffer = 0;
  102.    }
  103.  
  104. void set_number_tracks(n)
  105. int n;
  106.    {
  107.    }
  108.